import { IFeidaoAiBrowserComponent } from '@feidao/web/interfaces';
import nodejs from '@feidao/web/atom/browser/msg/nodejs';
import render from '@feidao/web/atom/browser/render/render';

import P01 from './P01';
import P02 from './P02';
import P03 from './P03';

export default async function a009(fd: IFeidaoAiBrowserComponent, ...args: any[]) {
	// 删除
	console.log('zj-manage-001 init n', args);
	let page_no = fd.data.params['page_no'];
	if (!page_no) {
		page_no = 1;
	}
	let page_size = fd.data.params['page_size'];
	if (!page_size) {
		page_size = 20;
	}
	const c = fd.data.params.param;
	const query = {
		criteria: c ? c : {},
		page_no,
		page_size
	};
	const res = await nodejs(fd.data.spaceid, "exam_find", query);
	if (res.c == 0) {
		render(fd, '', P02, 'P02', 'inner');
	} else {
		render(fd, res.dataArray, P01, 'P01', 'inner');
	}
	res['page_size'] = page_size;
	render(fd, res, P03, 'P03', 'inner');
}
